

x=-pi:pi;
y=sin(x);

new_x=-pi:0.1:pi;
new_y_pchip=pchip(x,y,new_x);% 分段三次埃米尔特插值
new_y_spline=spline(x,y,new_x);% 三次样条插值

plot(x,y,"*",new_x,new_y_pchip,"-",new_x,new_y_spline);
legend("样本点","分段三次埃米尔特插值","三次样条插值","Location","southeast")


